package co.edu.poli.ficb.agl.automatable.graph;

import org.apache.commons.collections15.Factory;

import co.edu.poli.ficb.agl.automatable.modelo.automatas.Automata;
import co.edu.poli.ficb.agl.automatable.modelo.automatas.EstadoImpl;

/**
 * 
 * @author Diego David Satoba Castro
 * @version 0.1 25/07/11
 * @since 0.1
 *
 */
public class VerticeFactory implements Factory<Vertice> {
	
	private Automata automata;
	
	private int i = 0;
	
	public VerticeFactory(Automata automata) {
		this.automata = automata;
	}	
	
	@Override
	public Vertice create() {
		String etiqueta = "";
		do {
			etiqueta = "e"+(i++);
		} while (automata.getEstados().contains(new EstadoImpl(etiqueta)));
		return new Vertice(etiqueta);
	}
}